NO! Word processor files contain much more than the characters you type, like font and page layout information, and are not suitable for creating data files for QBasic.
Here is a QBasic program that reads the data file you just created. The program reads in each integer, then prints it to the screen. Start QBasic in the same subdirectory that holds the data file. Enter and run the program in the usual way.
' Read in and echo the first three ' integers in DATA.DAT ' CLS ' Clear the output screen OPEN "DATA.DAT" FOR INPUT AS #1 ' Open the file for INPUT INPUT #1, NUM ' Read in the first number PRINT NUM ' Print out the first number INPUT #1, NUM ' Read in the second number PRINT NUM ' Print out the second number INPUT #1, NUM ' Read in the third number PRINT NUM ' Print out the third number END
First the program clears away whatever characters my be in the DOS window.
Then it opens the disk file DATA.DAT.
Opening a file for INPUT means finding it on the disk and preparing it
for reading.
After the file has been opened, it corresponds to file number
#1
.
The statements
that read the file are nearly the same as the INPUT statements
that read data from the keyboard.
What do you think the statement INPUT #1, NUM
does?